﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class sandbox_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            displayCookie();
        }
    }

    private void displayCookie()
    {
        GeoLingManager glManager = new GeoLingManager(Request, Response);
        String txt = "";
        txt += "Browser langugae";
        txt += "<BR/>";
        txt += glManager.getLangBrowserPref();
        txt += "<BR/>";

        CookiesManager cookieMonster = new CookiesManager(Request, Response);
        txt += "<BR/>";
        txt += "Cookie User Id:" + cookieMonster.getCookieValue(Citiport.Core.Const.COOKIE_USER_ID);
        txt += "<BR/>";
        txt += "Cookie User Lang:" + cookieMonster.getCookieValue(Citiport.Core.Const.COOKIE_USER_LANG);

        txt += "<BR/>";

        txt += "USE LANG: " + glManager.getLang();

        sandbox.Text = txt;
    }

    protected void Bt_set_Click(object sender, EventArgs e)
    {
        CookiesManager cookieMonster = new CookiesManager(Request, Response);
        cookieMonster.addCookie(Citiport.Core.Const.COOKIE_USER_ID, "1", DateTime.Now.AddYears(30));
        cookieMonster.addCookie(Citiport.Core.Const.COOKIE_USER_LANG, "", DateTime.Now.AddYears(30));
        displayCookie();
    }
    protected void Bt_remove_Click(object sender, EventArgs e)
    {
        CookiesManager cookieMonster = new CookiesManager(Request, Response);
        cookieMonster.removeCookie(Citiport.Core.Const.COOKIE_USER_ID);
        cookieMonster.removeCookie(Citiport.Core.Const.COOKIE_USER_LANG);
        displayCookie();
    }
}
